package com.elitedatai.mchtest.flyer.model.enums;

import java.util.Arrays;

/**
 * 飞手状态枚举类
 */
public enum FlyerStatusEnum {

    /**
     * 在职
     */
    ACTIVE(1, "在职"),

    /**
     * 离职
     */
    RESIGNED(2, "离职"),

    /**
     * 飞行中
     */
    FLYING(3, "飞行中"),

    /**
     * 空闲
     */
    IDLE(4, "空闲"),

    /**
     * 未知状态
     */
    UNKNOWN(-1, "未知");

    private int val;

    private String desc;

    FlyerStatusEnum(int val, String desc) {
        this.val = val;
        this.desc = desc;
    }

    public int getVal() {
        return this.val;
    }

    public String getDesc() {
        return this.desc;
    }

    public static FlyerStatusEnum find(int val) {
        return Arrays.stream(FlyerStatusEnum.values())
                .filter(status -> status.val == val)
                .findFirst()
                .orElse(UNKNOWN);
    }
}